//用户资源Api
import {get, post, put, del} from "../utils/request";

//获取所有资源
export function fetchAllResourceList() {
    return get('/resource/listall')
}

//获取资源
export function getItem(id) {
    return get('/resource/getitem/' + id)
}

//分页模糊查询
export function fetchList(params) {
    return get('/resource/list', params)
}

// 新增资源
export function createResource(info) {
    const data = {
        "categoryId": info.categoryId,
        "createTime": info.createTime,
        "description": info.description,
        "name": info.name,
        "url": info.url
    }
    return post('/resource/insert', data)
}

// 更新资源
export function updateResource(info) {
    const data = {
        "categoryId": info.categoryId,
        "createTime": info.createTime,
        "description": info.description,
        "name": info.name,
        "url": info.url
    }
    return post('//resource/update/' + info.id, data)
}

// 删除资源
export function deleteResource(id) {
    return del('/resource/del/' + id)
}